About 607 letters

About 3 minutes

#filter

Description: Filters data.

def filter(fn, iterable): ''' Filters data :param fn: Callback function, returns True to keep the element, False to discard it :param iterable: The iterable to filter :return: A filtered iterable '''

Example:

numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] print(filter(lambda x : x % 2 == 0, numbers)) print(list(filter(lambda x : x % 2 == 0, numbers)))

>>> Establishing WebAssembly Runtime.

>>> Standby.

Powered by Shift.

Created in 6/9/2025

Updated in 6/9/2025